package kiwi.assist.dev.reflect {
	import ghostcat.util.ReflectUtil;

	import flash.display.DisplayObject;

	/**
	 * flash的常规ui反射类
	 * 
	 * @author zhangming.luo
	 */
	public class FlashUiComponentReflectFactoryImpl implements IReflectFactory {
		public function newInstance(config : XML) : * {
			var spec : UiComponentSpec = new UiComponentSpec();
			try {
				var impl : DisplayObject = spec.createObject(config);
				return impl;
			} catch(e : Error) {
				trace(config.toXMLString());
				trace(e.getStackTrace());
			}
			return null;
		}

		public function getClass(config : XML) : Class {
			return ReflectUtil.getDefinitionByName(config.name().toString());
		}
	}
}
